package com.zmj.controller;

import com.zmj.common.Res;
import com.zmj.entity.SignUp;
import com.zmj.service.SignUpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/up")
public class SignUpController {

    @Autowired
    SignUpService signUpService;

    @PostMapping("/create")
    public Res createEn(@RequestBody SignUp signUp){
        boolean res = signUpService.createEn(signUp);
        if (res){
            return Res.create(1,"报名",signUp);
        }else {
            return Res.create(0,"???",null);
        }
    }

    @GetMapping("/info")
    public Res getUpInfo(){
        List<SignUp> list = signUpService.getUpInfo();
        if (list!=null){
            return Res.create(1,"报名",list);
        }else {
            return Res.create(0,"??",null);
        }
    }
}
